package com.work.controller.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 以/img/开头的路径，可以访问到d盘img目录下的文件
        registry.addResourceHandler("/img/**").
                addResourceLocations("file:d:/img/");
    }
}
